//Reload脚本方便调试

var reloadJs = {
	_reloadlist:null,
	_callback:null
}

reloadJs.setaction = function(srclist, callback){
	this._reloadlist = srclist
	this._callback= callback
}

reloadJs.reload = function(){
	cc.loader.reloadJs("", this._reloadlist, this._callback)
}

reloadJs.addListener = function(node){
	var mouselistener = cc.EventListener.create({
		event:cc.EventListener.MOUSE,
		onMouseDown:function(event){
			if (event.getButton() == cc.EventMouse.BUTTON_RIGHT){
				reloadJs.reload()			
			}
		}
	})
	cc.eventManager.addListener(mouselistener, node)
}

cc.loader.reloadJs = function(basepath, jspath, callback){
    var self = this,
        args = self._getArgs4Js(arguments);

    var preDir = args[0], list = args[1], callback = args[2];

    cc.async.map(list, function (item, index, cb1) {
        var jsPath = cc.path.join(preDir, item);
        self._createScript(jsPath, true, cb1);
    }, callback);
}